package com.sali.entity;

import java.util.Calendar;

// 封装数据处理时间
public class DataProcessTime {

    private long processTime;

    private String year;

    private String month;

    private String day;

    private String hour;

    private String minute;

    @Override
    public String toString() {
        return "DateProcessTime{" +
                "processTime=" + processTime +
                ", year='" + year + '\'' +
                ", month='" + month + '\'' +
                ", day='" + day + '\'' +
                ", hour='" + hour + '\'' +
                ", minute='" + minute + '\'' +
                '}';
    }

    public static DataProcessTime getInstance() {
        DataProcessTime dateProcessTime = new DataProcessTime();

        Calendar instance = Calendar.getInstance();

        dateProcessTime.processTime = instance.getTimeInMillis();
        instance.setTimeInMillis(dateProcessTime.processTime);
        dateProcessTime.year = String.valueOf(instance.get(Calendar.YEAR));

        int month = (instance.get(Calendar.MONTH) + 1);
        dateProcessTime.month = String.valueOf(month < 10 ? "0" + month : month);

        int day = instance.get(Calendar.DAY_OF_MONTH);
        dateProcessTime.day = String.valueOf(day < 10 ? "0" + day : day);

        int hour = instance.get(Calendar.HOUR_OF_DAY);
        dateProcessTime.hour = String.valueOf(hour < 10 ? "0" + hour : hour);

        int minute = instance.get(Calendar.MINUTE);
        dateProcessTime.minute = String.valueOf(minute < 10 ? "0" + minute : minute);

        return dateProcessTime;
    }

    private DataProcessTime() {

    }

    public long getProcessTime() {
        return processTime;
    }

    public void setProcessTime(long processTime) {
        this.processTime = processTime;
    }

    public String getYear() {
        return year;
    }

    public void setYear(String year) {
        this.year = year;
    }

    public String getMonth() {
        return month;
    }

    public void setMonth(String month) {
        this.month = month;
    }

    public String getDay() {
        return day;
    }

    public void setDay(String day) {
        this.day = day;
    }

    public String getHour() {
        return hour;
    }

    public void setHour(String hour) {
        this.hour = hour;
    }

    public String getMinute() {
        return minute;
    }

    public void setMinute(String minute) {
        this.minute = minute;
    }
}
